package com.hotelsystem.service.impl;

import com.hotelsystem.dao.FloorMapper;
import com.hotelsystem.pojo.Floor;
import com.hotelsystem.service.FloorService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service(value = "floorServiceImpl")
public class FloorServiceImpl implements FloorService {
//
//    @Resource
//    private RedisTemplate<Object,Object> redisTemplate;

    @Resource
    private FloorMapper floorMapper;

    @Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
    @Override
    public List<Floor> getAllFloor() {

//        Object getAllFloor = redisTemplate.opsForValue().get("getAllFloorLists");
        List<Floor> getAllFloor = null;
        try {
//         if (getAllFloor == null){
            getAllFloor = floorMapper.getAllFloor();
//             redisTemplate.opsForValue().set("getAllFloorLists",getAllFloor);
//         }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return getAllFloor;
    }
}
